<?php
    header('Content-Type:text/html;charset=utf-8');
    $conn = new mysqli('localhost', 'root', '105776', 'zhaodada');
    if($conn->connect_error){
        die('连接失败' . $conn->connect_error);
    }
    $res = $conn->query("SELECT * FROM `comments`");
    $arr = array();
    while($row = mysqli_fetch_assoc($res)){
        $arr[] = $row;
    }
    echo json_encode($arr);
?>